package gdut.imis.controller;

import gdut.imis.Utils.Result;
import gdut.imis.domain.EmploymentFile;
import gdut.imis.service.EmploymentFileService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

/**
 * @Description
 * @Author JiaFu
 * @Date 2023/4/7 21:35
 */
@RestController
@RequestMapping("/employment-file")
@Api(value = "就业档案接口", tags = {"就业档案接口"})
@RequiredArgsConstructor
public class EmploymentFileController extends BaseController {
    private final EmploymentFileService employmentFileService;

    @ApiOperation("新增就业档案")
    @PostMapping("/addEmploymentFile")
    @PreAuthorize("@cp.hasPermission('employmentFile')")
    public Result addEmploymentFile(@RequestBody EmploymentFile employmentFile) {
        return employmentFileService.addEmploymentFile(employmentFile);
    }

    @ApiOperation("根据学生id查询学生就业信息")
    @GetMapping("/getEmploymentByStuId/{studentId}")
    public Result getEmploymentByStuId(@PathVariable("studentId") Long studentId){
        return employmentFileService.getEmploymentByStuId(studentId);
    }
}
